import { Navigate } from "react-router-dom";
import { useSelector } from 'react-redux'
// eslint-disable-next-line react/prop-types
function AuthRoute({ element }) {
    const token = useSelector(state => state.login.token);
    return(
        token ? <>{element}</> : <Navigate to="/login" replace={true}/>
    )
}
export default AuthRoute